<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
  function loadImg(src) {
    return new Promise((resolve, reject) => {
      const img = document.createElement('img');
      img.onload = () => {
        resolve(img);
      }
      img.onerror = () => {
        const err = new Error(`图片加载失败${src}`)
        reject(err);
      }
      img.src = src;
    })
  }

  const url1 = 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3791918726,2864900975&fm=26&gp=0.jpg';
  const url2 = 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3540604543,2535775646&fm=26&gp=0.jpg';

  (async function () {
    const img1 = await loadImg(url1)
    console.log(img1.height, img1.width)

    const img2 = await loadImg(url2)
    console.log(img2.height, img2.width)
  })()
</script>
</body>
</html>
